<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: bootstrap-editable-css"/>
    <th:block th:include="include :: header('小车状态修改')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-status-edit" th:object="${carNextStatus}">
            <input name="id" th:field="*{id}" type="hidden">
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">下次的X轴距离：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="distanceX" th:field="*{distanceX}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
<!--            <div class="form-group">    -->
<!--                <label class="col-sm-3 control-label">下次的Y轴距离：</label>-->
<!--                <div class="col-sm-8">-->
<!--                    <input name="distanceY" th:field="*{distanceY}" class="form-control" type="text">-->
<!--                </div>-->
<!--            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">对应拐点：</label>
                <div class="col-sm-8">
                    <input name="area" th:field="*{area}" class="form-control" type="text" readonly>
                    <a id="selectCustomer" class="btn btn-success" onclick="selectCustomer()">
                        ...
                    </a>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">是否载货：</label>
                <div class="col-sm-8">

                    <select name="zhzt" th:field="*{zhzt}" class="form-control m-b" >
                        <option value="1">空车</option>
                        <option value="0">载货</option>
                    </select>


                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer"/>
    <th:block th:include="include :: bootstrap-table-editable-js"/>
    <th:block th:include="include :: layout-latest-js"/>
    <th:block th:include="include :: ztree-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "system/status";
        $("#form-status-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-status-edit').serialize());
            }
        }


        function callbackCustomer(index, layero) {
            var orders = [];
            var obj = {};
            var row = $("#bootstrap-table").bootstrapTable('getSelections');
            var Members = layero.find("iframe")[0].contentWindow.result();
            if (Members.length == 0) {
                $.modal.alertWarning("请选择一条记录");
                return;
            }
            console.log("member", Members)
            console.log("row", row[0]);


            $("#area").val(Members[0].location)

            $.modal.close(index);
            $.modal.closeLoading();

        }


        function selectCustomer() {
            // var url = "/out/stockout/customer";
            // $.modal.open("选择经销商信息", url);

            var options = {
                title: '选择当前小车放置拐点',
                url: "/system/status/area",
                callBack: callbackCustomer
            };
            $.modal.openOptions(options);
        }

    </script>
</body>
</html>